package org.geektimes.configuration.source;

import org.eclipse.microprofile.config.spi.ConfigSource;

import java.util.Comparator;

/**
 * 配置优先级比较器
 * @author lanxing
 * @date 2021/3/18 14:42
 */
public class ConfigSourceOrdinalComparator implements Comparator<ConfigSource> {

    public static final Comparator<ConfigSource> INSTANCE = new ConfigSourceOrdinalComparator();

    @Override
    public int compare(ConfigSource o1, ConfigSource o2) {
        return Integer.compare(o2.getOrdinal(),o1.getOrdinal());
    }
}
